package com.xcity.game.battle.pve.employee.impl;

import com.xcity.game.battle.pve.PlayerBattler;
import com.xcity.game.battle.pve.employee.EmployeeSkillBattleContext;
import com.xcity.game.common.GameStaticConfig;
import com.xcity.game.employee.skill.EmployeeSkill;

//40		女神光芒		{2=90075#0}{3=90076#0}{4=90077#0}共同出场时，{0=100#0}降低对手攻击伤害{1=20#0}%
//40		稳固坚守		{2=90035#0}{3=90036#0}{4=90037#0}共同出场时，被对手攻击时有{0=60#0}%几率抵抗{1=50#0}%伤害
public class SKILL_40_CONTEXT extends EmployeeSkillBattleContext {

	public SKILL_40_CONTEXT(PlayerBattler player, EmployeeSkill ref) {
		super(player, ref);
	}

	@Override
	public boolean trigger() {
		int n = rnd.nextInt(GameStaticConfig.percentBase);
		if (n < ref.getTemplate().getInitVal(0)) {
			int reduce = (int) (player.getContext().getTarget().getAttack() * ref.getTemplate().getInitVal(1) / 100);
			player.setHp(player.getHp() + reduce);
			return true;
		}
		return false;
	}

}
